//
//  SISSBottomTextFieldFillInView.m
//  SISSAPP
//
//  Created by 优房网 on 2017/8/15.
//  Copyright © 2017年 优房网. All rights reserved.
//

#import "SISSBottomTextFieldFillInView.h"

@interface SISSBottomTextFieldFillInView ()
/* bottomLine */
@property (weak, nonatomic) UIView *bottomLine;

@end
@implementation SISSBottomTextFieldFillInView


#pragma mark - UI
- (void)initUI {
    [super initUI];
    
    UILabel *label = [[UILabel alloc] init];
    label.numberOfLines = 0;
    label.textColor = MAIN_TEXT_COLOR;
    label.font = [UIFont systemFontOfSize:16];
    label.textAlignment = NSTextAlignmentRight;
    [self addSubview:label];
    self.label = label;
    
    UITextField *textField = [[UITextField alloc] init];
    [self addSubview:textField];
    self.textField = textField;
    
    UIView *bottomLine = [[UIView alloc] init];
    bottomLine.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [self addSubview:bottomLine];
    self.bottomLine = bottomLine;
}

#pragma mark - 约束
- (void)initConstraint {
    [super initConstraint];
    WeakSelf
    CGFloat margin = 8.0;
    [self.label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.equalTo(weakSelf).offset(1.5 * margin);
    }];
    
    [self.textField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(weakSelf).offset(-margin);
        make.top.equalTo(weakSelf).offset(1.5 * margin);
    }];
    
    [self.bottomLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.textField.mas_bottom).offset(1.5 * margin);
        make.left.right.bottom.equalTo(weakSelf);
        make.height.mas_equalTo(1);
    }];
}


@end
